package org.adw.launcher2.ld.secret.dom;

import org.adw.launcher2.ld.secret.db.MySMSCache;
import org.adw.launcher2.ld.secret.ui.utils.Global;
import android.content.ContentValues;
import android.database.sqlite.SQLiteConstraintException;

/*
 * My SMS data
 */
public class MySMS {
	public long userId;
	public String userNickname;
	public String phoneNumber;
	public MySMS(long userId, String userNickname, String phoneNumber) {
		this.userId = userId;
		this.userNickname = userNickname;
		this.phoneNumber = phoneNumber;
	}
	public static void hide(MySMS userSms) {
		MySMSCache cache = MySMSCache.getInstance(Global.dbHelper);
		// hide sms = insert a user into db and base on RECEIVER
		ContentValues values = new ContentValues();
		values.put("id", userSms.userId);
		values.put("user_name", userSms.userNickname);
		values.put("phone_number", userSms.phoneNumber);
		try{
			cache.insertUserToDb(values);
		}catch(SQLiteConstraintException ex){
			ex.printStackTrace();
		}
	}
	public static void restore(long id) {// not support insert to android db yet
		MySMSCache cache = MySMSCache.getInstance(Global.dbHelper);
		try{
			cache.deleteUserFromDb(id);
		}catch(SQLiteConstraintException ex){
			ex.printStackTrace();
		}
	}
}
